from fastapi import FastAPI
app = FastAPI()
print(hasattr(app, "state"))  # 输出应为 True